home *** CD-ROM | disk | FTP | other *** search
/ Shareware Super Platinum 8 / Shareware Super Platinum 8.iso / mac / ARCHIVE / PKBACKUP.ZIP;1 / PKBACKUP.DOC < prev   
Encoding:
Text File  |  1994-04-25  |  21.1 KB  |  507 lines

  1. ----------------------------------------------------------------
  2. -- PKBACKUP.DOC for PKBACKUP.BAT version 1.0 -- 24 April 1994 --
  3. ---- A Public Domain backup utility using PKZIP version 2.x ----
  4. ----------------------------------------------------------------
  5.  
  6.  
  7. 0.   Table of contents.
  8.      I.   Introduction.
  9.      II.  Syntax.
  10.      III. Use.
  11.           A.   How often to back up.
  12.           B.   How much to back up.
  13.           C.   How many diskettes to use.
  14.           D.   The backup pattern.
  15.      IV.  Recovering from file loss.
  16.           A.   Single file recovery.
  17.           B.   Total recovery.
  18.           C.   Problems and solutions.
  19.      V.   Environment and operation.
  20.      VI.  Modifying PKBACKUP.
  21.      VII. Further suggested reading.
  22.      VIII.Disclaimer, author, and credits.
  23.  
  24.  
  25. I.   Introduction.
  26.  
  27.      PKZIP 2.x has been enhanced over PKZIP 1.1 to include a
  28. feature called "disk spanning," by which a single ZIP may be
  29. created on several floppies.  This feature might be called a
  30. "poor man's" backup.  However, even poor men (or women) prefer to
  31. avoid command lines with lots of switches.  Therefore I have
  32. written PKBACKUP.BAT, a simple, easy to use and modify backup
  33. utility which takes care of the piddling details and attempts
  34. both to enable and encourage responsible data protection.
  35.  
  36.      PKBACKUP is designed to be an inexpensive (free if you
  37. already own PKZIP 2.x) Public Domain direct replacement for the
  38. MS-DOS BACKUP utility, with similar syntax.  Enhanced features
  39. include fewer diskettes required to perform a backup, enhanced
  40. error detection, simpler syntax, and (in my opinion) easier
  41. recovery procedures with more options.
  42.  
  43.      This document describes PKBACKUP and its use.  It also
  44. discusses backup strategy and data recovery using worked examples
  45. to illustrate key concepts.
  46.  
  47.  
  48. II.  Syntax.
  49.  
  50.      PKBACKUP.BAT is patterned after the MS-DOS backup command. 
  51. The command syntax is:
  52.  
  53.           PKBACKUP   SOURCE   DESTINATION   [/SWITCH]
  54.  
  55. where SOURCE is the drive to be backed up (*without* the colon,
  56. ex: 'C', not 'C:'), DESTINATION is the drive to be backed up onto
  57. (again, *without* the colon), and the optional SWITCH indicates
  58. what kind of backup to perform.  DESTINATION must be a removable
  59. drive (read: floppy).
  60.  
  61.      There are three kinds of backups.  The first is a total or
  62. FULL backup.  This backup backs up all files on the source drive,
  63. as specified in PKZIP.CFG or the program's defaults, and then
  64. resets the archive bit on all files backed up.  (Normally, PKZIP
  65. skips any files with Hidden or System attributes set.) Thus, the
  66. command:
  67.  
  68.           PKBACKUP   C   A   /F
  69.  
  70. would correspond to the MS-DOS commands:
  71.  
  72.           VERIFY   ON
  73.           BACKUP   C:\*.*   A:   /S   /F
  74.  
  75.      The second backup is an incremental backup or WEEKLY backup. 
  76. This backup backs up all files modified since the latest FULL or
  77. WEEKLY backup (whichever was performed most recently) and then
  78. resets the archive bit on all files backed up.  Thus, the
  79. command:
  80.  
  81.           PKBACKUP   C   A   /W
  82.  
  83. would correspond to the MS-DOS commands:
  84.  
  85.           VERIFY   ON
  86.           BACKUP   C:\*.*   A:   /S   /M   /F
  87.  
  88.      The third backup is a DAILY backup.  Like the WEEKLY backup,
  89. this backup backs up all files modified since the latest FULL or
  90. WEEKLY backup (whichever was performed most recently), however
  91. this backup does not reset archive bits on any files backed up. 
  92. Thus, the command:
  93.  
  94.           PKBACKUP   C   A   /D
  95. or
  96.           PKBACKUP   C   A
  97.  
  98. (the two commands are equivalent) would correspond to the MS-DOS
  99. command(s):
  100.  
  101.           FORMAT   A:
  102.           XCOPY   C:\*.*   A:   /S   /A   /V
  103.  
  104. (assuming all files to be backed up would fit on a single
  105. floppy.)  After each of the backups completes, PKBACKUP performs
  106. an optional verify pass on the backup set.
  107.  
  108.  
  109. III. Use.
  110.  
  111. A.   How often to back up.
  112.  
  113.      A fundamental question of data protection is: "How often
  114. should I perform backups on my system?"  The long answer is that
  115. you should back up frequently enough to recover quickly and
  116. completely with a minimum of re-entry should data loss of any
  117. sort occur.  However, there are a couple of relative terms in the
  118. long answer, open to interpretation, confusion, and perhaps
  119. disaster, so go with the short answer: "Every time you use it." 
  120. If you are entering data, downloading files, writing letters, or
  121. sometimes just playing games, the data files on your system
  122. change.  You should establish a practice of backing up before
  123. shutting off the system for the day.  For purposes of discussion,
  124. we will assume that the computer is used daily.
  125.  
  126.  
  127. B.   How much to back up.
  128.  
  129.      If a backup requires daily 20 diskettes and an hour of your
  130. time, you will not do it.  An "ideal" backup might require one
  131. minute and one diskette, so PKBACKUP was written to try to
  132. approach that "ideal."  In the scheme presented below, a "full"
  133. or total system backup would be performed once every 28 days. 
  134. Thereafter (assuming normal use), much smaller, quicker, partial
  135. backups would suffice.
  136.  
  137.      In this scheme, there are 10 separate backup sets.  One set,
  138. labeled "F1", would be large enough to perform a FULL backup, and
  139. nine smaller sets of the same size, labeled "W1" through "W3" and
  140. "D1" through "D6" for WEEKLY and DAILY sets, respectively.
  141.  
  142.  
  143. C.   How many diskettes to use.
  144.  
  145.      The FULL set would require (assuming a common file mix)
  146. approximately the number of diskettes which can be determined by
  147. this formula:
  148.  
  149.      number_of_diskettes = (FS / (CR * MS)) (rounded up)
  150.  
  151. where:
  152.  
  153.      FS   (File Size) is the number of bytes to back up (which
  154.           can be determined by using MS-DOS CHKDSK)
  155.      CR   (Compression Ratio) is how well PKZIP performs
  156.           compressing files.  Depending on you file mix, this can
  157.           vary between 1.0 (the worst possible) to 1.5 (poor) to
  158.           2.0 (excellent) or higher.  A value of 1.7 is typical. 
  159.           When in doubt, use that.
  160.      MS   (Media Size) is the number of usable bytes on a floppy.
  161.           The figure can be rounded to simplify arithmetic. 
  162.           (Remember this is an approximate calculation.)  Use the
  163.           table below (Table 1):
  164.  
  165.  
  166.      Table 1: Approximate file bytes on common media.
  167.  
  168.      Media size     Recording method    Usable bytes
  169.      ----------     ----------------    ------------
  170.      3-1/2"         DSDD                  720,000
  171.      3-1/2"         DSHD                1,440,000
  172.      5-1/4"         DSDD                  360,000
  173.      5-1/4"         DSHD                1,200,000
  174.  
  175.  
  176.      Suppose you have a 104 MB partition as drive C: and MS-DOS
  177. CHKDSK indicates you are using 55,000,000 bytes (FS=55,000,000),
  178. and that your floppy drive A: is a high density 5-1/4" drive (and
  179. that you will be using high density floppies (MS=1,200,000). 
  180. Applying the formula with a 1.7 compression ration (assuming a
  181. typical file mix -- CR=1.7):
  182.  
  183.      number_of_diskettes = (55,000,000 / (1.7 * 1,200,000)) 
  184.                               (rounded up)
  185.                          = 26.96 (rounded up)
  186.                          = 27
  187.  
  188.      A WEEKLY or DAILY set is harder to estimate, since it
  189. depends on the number and size of files modified.  Start by
  190. assuming each set requires two diskettes and be prepared to
  191. revise upwards.  Using these assumptions, the number of diskettes
  192. to buy initially for this example is shown in Table 2:
  193.  
  194.      Table 2: Diskettes required for backup sets (worked
  195.                example).
  196.  
  197.      Backup type    Sets needed    Diskettes/set  Total diskettes
  198.      -----------    -----------    -------------  ---------------
  199.      FULL            1             * 27           = 27
  200.      WEEKLY          3             *  2           =  6
  201.      DAILY           6             *  2           = 12
  202.      -----          --                            ----
  203.      TOTAL          10                              45
  204.  
  205.      If you buy your diskettes in lots of ten, hold your nose and
  206. buy 50.  Remember, this is *still* better than MS-DOS BACKUP
  207. which would require about 46 or 47 diskettes just for the FULL
  208. backup alone.
  209.  
  210.      WARNING: If you are using low density diskettes in a high
  211. density drive (ex: 360 KB DSDD floppies in a 1.2 MB HD drive)
  212. then YOU MUST FORMAT THEM LOW DENSITY BEFORE USING PKBACKUP. 
  213. Otherwise, PKZIP will format them high density.
  214.  
  215.  
  216. D.   The backup pattern.
  217.  
  218.      Why these three kinds of backups?  PKBACKUP was written with
  219. the following scheme in mind.  Initially, you would perform a
  220. FULL backup on a disk.  This would back up all files, and form a
  221. basis for all further backups in the series.  We will call this
  222. "day zero."  For the next 6 days, you would perform DAILY
  223. backups, using backup sets D1 through D6. On day seven, you would
  224. perform a WEEKLY backup using backup set W1.  On days eight
  225. through thirteen you would do DAILY backups, reusing backup sets
  226. D1 through D6.  On day fourteen you would perform a WEEKLY backup
  227. using backup set W2.  On days fifteen through twenty you would
  228. perform DAILY backups again on D1 through D6.  On day twenty-one
  229. you would perform a WEEKLY backup on backup set W3.  Finally, for
  230. days twenty-two through twenty-seven you would do DAILY backups
  231. again on D1 through D6.  Day 28 would be day zero of the next
  232. cycle, and the process would repeat. Graphically, this might be
  233. represented as shown in Table 3 (below):
  234.  
  235.      Table 3: Sequence of backups in a 28-day backup scheme.
  236.  
  237.      Type           Set       Day
  238.      ----           ---       ---
  239.      FULL           F1        day 0
  240.          DAILY      D1-6      days 1 to 6
  241.        WEEKLY       W1        day 7
  242.          DAILY      D1-6      days 8 to 13
  243.        WEEKLY       W2        day 14
  244.          DAILY      D1-6      days 15 to 20
  245.        WEEKLY       W3        day 21
  246.          DAILY      D1-6      days 22 to 27
  247.  
  248.      This scheme has the following characteristics:  It is always
  249. possible to restore files for the previous seven days, and before
  250. that, at one week intervals.  Therefore, if you back up at the
  251. end of a day, and file loss occurs at noon on day 18 (before
  252. backup on that day), then the following backups would be
  253. available, as shown in Table 4 (below).
  254.  
  255.  
  256.      Table 4: Backups available on day 18 in a 28 day backup 
  257.                scheme.
  258.  
  259.      Number         Type      Set       Day performed
  260.      ------         ----      ---       -------------
  261.      1              FULL      F1        day 0
  262.      2              WEEKLY    W1        day 7
  263.      3              DAILY     D4        day 11
  264.      4              DAILY     D5        day 12
  265.      5              DAILY     D6        day 13
  266.      6              WEEKLY    W2        day 14
  267.      7              DAILY     D1        day 15
  268.      8              DAILY     D2        day 16
  269.      9              DAILY     D3        day 17
  270.  
  271.      NOTE: The method described above can be adapted to work for
  272. other time frames just as easily.  If backups are performed
  273. weekly, then 17 backup sets consisting of one FULL set, 12
  274. monthly sets and 4 weekly sets will back up an entire year. 
  275. Other schemes are possible.  The important part is that there
  276. must be an initial FULL backup, followed by WEEKLY backups at
  277. specified intervals and DAILY backups between them.
  278.  
  279.  
  280. IV.  Recovering from file loss.
  281.  
  282.      Sooner or later, it will be necessary to restore one or more
  283. files from backup.  Whether from accidental deletion of a single
  284. file (oops) all the way up to catastrophic disk failure (ARGH!
  285. *SOB*), PKBACKUP creates backup sets capable of recovery.
  286.  
  287.      To illustrate recovery methods, we will continue use of the
  288. 28 day backup scheme described earlier and examine recovery
  289. techniques used if data loss occurred after backup on day 17. 
  290. (See section III D for details).  (Remember that for this
  291. discussion drive C: is backed up onto drive A:)
  292.  
  293.      NOTE: Before attempting recovery of any sort, you should be
  294. familiar with PKUNZIP.  The more you know about this utility, the
  295. more options for recovery you will have.  See Section VII for
  296. suggested reading.
  297.  
  298.  
  299. A.   Single file recovery.
  300.  
  301.      Suppose a single file named C:\GONE\BYE.BYE was accidently
  302. deleted at noon on the eighteenth day as described in Section III
  303. D.  Table 4 (above) shows the nine backups available.  BYE.BYE
  304. should be on at least one of them (see IV C -- Problems and
  305. Solutions, below), and might be on several or all, depending on
  306. whether the file was modified.  In this case we would want the
  307. youngest (most recently modified) copy.  Therefore we would start
  308. with the latest backup, backup number 9 (performed on day 17),
  309. and search the backups in reverse chronological order.  To search
  310. a backup for a file, place the LAST disk of the set (yes, you
  311. heard me correctly!) in the floppy drive and (assuming that it is
  312. drive A:) type in the following command:
  313.  
  314.           PKUNZIP   -v   a:*.zip   bye.bye
  315.  
  316. (If you forget, and put the first floppy of the set in the drive,
  317. PKUNZIP will prompt you to put the last floppy of the set in the
  318. drive.  All you will have lost is some time.)  It is not
  319. necessary to give the full path of the file, the true name of the
  320. ZIP file, or even the full name of the file itself, since
  321. wildcards can be used in the filename.  Any file matching a
  322. specification will be displayed along with "directory-like"
  323. information such as size, attributes, date and time of
  324. creation/last update, full path name, and a few other fields
  325. which will not be important to the restoration process.  If the
  326. file is not in the backup set, PKUNZIP will issue a warning.  If
  327. several files match the specification, they will all be
  328. displayed.  It is your responsibility to determine which, if any,
  329. is the file you want.  If the file is not found in backup 9,
  330. continue the search using backup 8, and so on.
  331.  
  332.      Once the right backup set has been determined, restoring a
  333. single file can be done using the following command, assuming C:
  334. is the backup drive and A: is the floppy drive.
  335.  
  336.           PKUNZIP   -d   -o-   a:*.zip   filename.ext   c:\
  337.  
  338. so in our example we would type:
  339.  
  340.           PKUNZIP   -d   -o-   a:*.zip   BYE.BYE   c:\
  341.  
  342. If more than one file matches a specification, all files will be
  343. restored. If a file already exists by the same name, PKUNZIP will
  344. skip the file. (This would almost certainly mean that the
  345. specification was incorrect or there was more than one file with
  346. that name in the backup.) If no files could be restored, PKUNZIP
  347. would issue a warning.
  348.  
  349.  
  350. B.   Total recovery.
  351.  
  352.      Suppose the very worst has happened, and the disk is lost. 
  353. After replacing or reformatting the disk and installing a minimum
  354. amount of the operating system, if necessary (you did have a
  355. rescue disk of some kind around, didn't you?) we must restore the
  356. latest DAILY backup, then all WEEKLY backups in reverse
  357. chronological order, then finally the FULL backup.  In our worked
  358. example, assuming loss on day 18, we would restore backups 9, 6,
  359. 2, and 1 in that order.  (See table 4.)  Assuming that drive C:
  360. was lost, and that enough of MS-DOS has been installed (and in
  361. the SAME place as before), we could enter the following command:
  362.  
  363.           PKUNZIP   -o-   -d   a:*.zip   c:\
  364.  
  365. for each backup set (even from another drive) and only those
  366. files which had not yet been restored would be written to the
  367. hard drive.
  368.  
  369.  
  370. C.   Problems and solutions.
  371.  
  372.      PKBACKUP, like MS-DOS BACKUP, requires a file's Archive bit
  373. to be set before it will back it up in a WEEKLY or DAILY backup. 
  374. Therefore, if one resets the Archive bit with the MS-DOS ATTRIB
  375. command, performs a regular MS-DOS BACKUP, renames an already
  376. backed up file (which will not affect the Archive bit), or
  377. anything else which messes with the Archive bit for a file, then
  378. that file will not be backed up, or possibly it may be backed up
  379. though it does not need to be.  If this represents a problem for
  380. you, then maybe you ought to be using a different method for
  381. performing backups.
  382.  
  383.      On the other hand, with a little care and attention to
  384. detail this should not be a serious problem.  Don't use both
  385. MS-DOS BACKUP and PKBACKUP.  Don't use XCOPY's /M switch.  Don't
  386. use ATTRIB to clear the Attribute bit of a file unless you know
  387. EXACTLY what you are doing. Instead of RENaming a file, COPY it,
  388. then DELete the original.  (Be aware that the file with the
  389. original name may exist on a backup, which might cause a problem
  390. if a total recovery is necessary.)  Remember that a file created
  391. and deleted between backups cannot be recovered using techniques
  392. described here.
  393.  
  394.      A different problem is that PKBACKUP may back up certain
  395. files not desired or may skip other files.  There are frequently
  396. files or directories  on the root directory which are useless for
  397. backup purposes since they relate to file undeletion, format
  398. recovery, antiviral protection, or some other utility purpose. 
  399. If that is the case, then PKBACKUP can be modified to exclude
  400. such files.  Another possible problem is that, by default PKZIP
  401. (and therefore PKBACKUP) does not back up any file with the
  402. Hidden or System file attributes set.  This is probably the way
  403. you want it anyway, but if necessary PKBACKUP can be modified to
  404. back these up as well.
  405.  
  406.  
  407. V.   Environment and operation.
  408.  
  409.      PKBACKUP is designed to run under MS-DOS 3.0 (preferably
  410. MS-DOS 3.3) or later.  It uses PKZIP 2.0x to perform backups.  (I
  411. have done all testing using PKZIP 2.04g, registered version.)  No
  412. other programs are used -- all functions are performed by batch
  413. commands.  PKBACKUP has been tested under PC-DOS 3.3 on an IBM
  414. PC/AT with 640 KB RAM memory and under MS-DOS 5.0 on a 386 clone
  415. with 4 MB RAM memory with QEMM 7.03, EMS, XMS, and DPMI support. 
  416. Your mileage may vary, but it worked fine for me. PKBACKUP tries
  417. to be tolerant about uppercase/lowercase, and provides default
  418. operation if omitted.  It does careful checking as to legal
  419. SOURCE and DESTINATION drives, and provides an informative usage
  420. message if a syntax violation is discovered.  If a runtime error
  421. occurs, PKBACKUP attempts to diagnose the problem and present an
  422. appropriate error message.
  423.  
  424.      NOTES: PKBACKUP will switch to the drive which is being
  425. backed up, uses Maximum compression, MS-DOS VERIFY ON, and uses
  426. PKZIP or system defaults to determine memory usage.  It will span
  427. disks, if necessary, and always starts out by formatting each
  428. floppy it uses.  It does a quick format, if possible.  The ZIP
  429. file produced has the following name on all floppies in a backup
  430. set:
  431.  
  432.           Type           Name
  433.           ----           ----
  434.           FULL           full_X.zip
  435.           WEEKLY         week_X.zip
  436.           DAILY          daily_X.zip
  437.  
  438. where X is the SOURCE drive from the invocation.
  439.  
  440.  
  441. VI. Modifying PKBACKUP.
  442.  
  443.      PKBACKUP has been written with the certainty of change as a
  444. design criteria.  Many parameters may be altered by REM'ing out
  445. or unREM'ing sections of code already included in the batch file. 
  446. It is a simple matter to change legal source or destination
  447. drives, or default operation. The use of the PKTMP environmental
  448. variable is selectable, as is the MS-DOS VERIFY option.  There is
  449. only one file, so all portions of the batch can be printed as one
  450. file.  I didn't try to do *anything* tricky.
  451.  
  452.      One area of possible improvement for PKBACKUP is the
  453. compression method.  I chose Maximum compression to reduce the
  454. number of diskettes. If you have a slow machine (I have a 8 mhz
  455. AT), then it may be worth it to you to use a faster compression
  456. level and use more floppies.
  457.  
  458.  
  459. VII. Further suggested reading.
  460.  
  461.      If you are interested modifying PKBACKUP, or want to know
  462. more about concepts described in this document, I would suggest
  463. reading the "PKZIP 2 for DOS Manual" which is given with every
  464. registered copy of PKZIP 2.x.  (Don't just use the shareware
  465. version, buy the real thing.) There is a section in the book
  466. called "Tutorial" which has a subsection "Storing and Rebuilding
  467. Directory Structures" which I recommend.  Also, when in doubt,
  468. consult the help screens for PKZIP and PKUNZIP.
  469.  
  470.  
  471. VIII.     Disclaimer, author, and credits.
  472.  
  473.      PKBACKUP.BAT and this file PKBACKUP.DOC are hereby released
  474. into the public domain.  Use them, modify them, and/or abuse them
  475. as you see fit.  If you wish, include them as part of a package
  476. you sell.  (Please include this file if you are a gentleman,
  477. sir.)  Naturally, I assume no liability for ANYTHING that goes
  478. wrong, either directly or indirectly, (ESPECIALLY if the code is
  479. modified).  If you want a warranty, go to someone else.
  480.  
  481.      On the other hand, if you want to thank me (the author) I
  482. can be reached at the following address:
  483.  
  484.           Phil Hair
  485.           961 Reynolds Rd., #125
  486.  
  487.           Toledo, OH  43615
  488.  
  489.      Have fun.
  490.                          -- Phil
  491.  
  492.  
  493.      PKZIP and PKUNZIP are registered trademarks of PKWARE, Inc.
  494.  
  495.      MS-DOS is a registered trademark of Microsoft Corporation.
  496.  
  497.      IBM, IBM PC/AT, and PC-DOS are registered trademarks of
  498.      International Business Machines Corporation.
  499.  
  500.      QEMM is a registered trademark of Quarterdeck, Inc.
  501.  
  502.      The author is not associated with PKWARE, Inc.
  503.  
  504. ----------------------------------------------------------------
  505. ----------------------- END OF DOCUMENT ------------------------
  506. ----------------------------------------------------------------
  507.